﻿$(document).on("pageInit", "#detail-attendence", function (e, id, page) {
    loadList();

    function loadList() {
        $.getJSON("/Attendance/GetAttendanceDetail?groupId=" + $(page).find('[name="id"]').val(), function (response) {
            console.log(response);
            $(page).find('[name="GroupName"]').html(response.Group.GroupName);
            $(page).find('[name="ClazzName"]').html(response.Group.ClazzName);

            var $stuList = $(page).find('#stu-list');
            $stuList.empty();

            $.each(response.AttendanceList, function (rIndex, rItem) {
                var status = {
                    1: "出勤",
                    2: "缺勤",
                    3: "迟到",
                    4: "旷课",
                    5: "早退"
                };
                $stuList.append('<li class="item-content">\
                                    <div class="item-media"><i class="icon icon-f7"></i></div>\
                                    <div class="item-inner">\
                                      <div class="item-title">' + rItem.StudentName + '</div>\
                                      <div class="item-after">' + status[rItem.Status] + '</div>\
                                    </div>\
                                  </li>');
            });
        });
    }
});